Fix incorrect URL generation in getContentUrl()#3759
Open
darth-antony wants to merge 1 commit intoStudio-42:masterfrom
Open
Fix incorrect URL generation in getContentUrl()#3759darth-antony wants to merge 1 commit intoStudio-42:masterfrom
darth-antony wants to merge 1 commit intoStudio-42:masterfrom
Conversation
trim($this->root, '/') strips the leading slash from the root path, making strlen() return a value 1 less than expected. This causes substr() to include an extra character from the root folder name in the relative path. For example, with root folder "images": - Expected URL: /files/image.jpg - Actual URL: /files/s/image.jpg Using strlen($this->root) + 1 is consistent with other URL construction methods in elFinderVolumeLocalFileSystem (lines 206, 612, 845, 1420) which all use this correct pattern. Fixes Studio-42#3746
|
Any news on this https://github.com/Studio-42/elFinder/blob/master/php/elFinderVolumeDriver.class.php#L3334? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
trim($this->root, '/') strips the leading slash from the root path, making strlen() return a value 1 less than expected. This causes substr() to include an extra character from the root folder name in the relative path.
For example, with root folder "images":
Using strlen($this->root) + 1 is consistent with other URL construction methods in elFinderVolumeLocalFileSystem (lines 206, 612, 845, 1420) which all use this correct pattern.
Fixes #3746